//
// Created by LangJie on 2023/8/6.
//
#include <iostream>
#include <chrono>
#include <thread>
#include "Arduino.h"
extern void setup();
extern void loop();

void Main(){
    setup();
    setvbuf(stdout, NULL, _IONBF, 0);
    while (1){
        loop();
    }
}

void delay(uint32_t ms) {

    Sleep(ms);
}
unsigned long millis(){
    unsigned long r=  GetTickCount();
    return r;

}
void delay1(uint32_t ms) {
    //储存计数的联合
    LARGE_INTEGER fre;
    //获取硬件支持的高精度计数器的频率
    if (QueryPerformanceFrequency(&fre))
    {
        LARGE_INTEGER run, priv, curr, res;
        run.QuadPart = fre.QuadPart * ms / 1000;
        //获取高精度计数器数值
        QueryPerformanceCounter(&priv);
        do
        {
            QueryPerformanceCounter(&curr);
        } while (curr.QuadPart - priv.QuadPart < run.QuadPart);
        curr.QuadPart -= priv.QuadPart;
        int nres = (curr.QuadPart * 1000000 / fre.QuadPart);//实际使用微秒时间
    }
}


